/*
 * @Author: szx
 * @Date: 2021-12-02 16:59:35
 * @LastEditTime: 2021-12-02 17:04:32
 * @Description:
 * @FilePath: \leetcode\1-99\26\26.js
 */
/**
 * @param {number[]} nums
 * @return {number}
 */
var removeDuplicates = function (nums) {
    let left = 0;
    for (let i = 1; i < nums.length; i++) {
        if (nums[i] != nums[left]) {
            left++;
            nums[left] = nums[i];
        }
    }
    return left + 1;
};
let nums = [0, 0, 1, 1, 1, 2, 2, 3, 3, 4];
console.log(removeDuplicates(nums));
console.log(nums);
